package com.whut.provider.controller;


import com.whut.common.util.R;
import com.whut.provider.entity.Sensor;
import com.whut.provider.service.ISensorService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2021-01-13
 */
@RestController
@RequestMapping("/sensor")
public class SensorController {

    @Resource
    private ISensorService sensorService;

    @ApiOperation("通过名称查询sensor表")
    @PostMapping("/getSensorByName")
    public R<List<Sensor>> selectSensor(@RequestParam String sensorName) {
        return R.ok(sensorService.selectAll(sensorName));
    }

    @ApiOperation("查询sensorList")
    @PostMapping("/selectList")
    public R<List<Sensor>> selectList() {
        return R.ok(sensorService.list());
    }
}
